//
//  WYComposeMenuButton.swift
//  WYWeibo
//
//  Created by wangyi on 16/7/20.
//  Copyright © 2016年 wangyi. All rights reserved.
//

import UIKit

class WYComposeMenuButton: UIButton {
    
    //持有跳转的控制器模型
    var composeMenu: WYComposeMenu?
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUPUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setUPUI() {
    
        titleLabel?.font = UIFont.systemFontOfSize(15)
        setTitleColor(UIColor.grayColor(), forState: .Normal)
        titleLabel?.textAlignment = .Center
    }
    
    //重写 highlighted 属性
    override var highlighted: Bool {
        
        get{
            return false
        } set {
  
        }
    }
    //布局 重新布局
    override func layoutSubviews() {
        super.layoutSubviews()
        
        //调整子控件宽度
        imageView?.y = 0
        
        imageView?.width = width
        imageView?.height = width
        
        titleLabel?.x = 0
        titleLabel?.y = width
        titleLabel?.width = width
        titleLabel?.height = height - width
        
        
    }
}
